*Please use "TS_Distributive Politics.dta"
*Pleas install outreg2 first
*Please change directory: cd "C:\XXX"

*table 1
logit greencard2 absakpbdpcomp09 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol totalterrorbyID2  if eligible==1 & kurdish==1, cluster(ilceid) or
outreg2 using greencardturkish, bdec(3) excel replace label eform cti(odds ratio)
logit greencard2 absakpbdpcomp09 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol totalterrorbyID2  if eligible==1 & kurdish==0, cluster(ilceid) or
outreg2 using greencardturkish, bdec(3) excel append label eform cti(odds ratio)

*figure 2
logit greencard2 absakpbdpcomp09 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol totalterrorbyID2  if eligible==1 & kurdish==1, cluster(ilceid) 
margins, at(absakpbdpcomp09=(0.1(0.1)0.7) (median) akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural akparticontrol (mean) lnvoters totalterrorbyID2)
marginsplot

*Appendix
*descriptive statistics
sum greencard2 kurdish akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural absakpbdpcomp09 totalterrorbyID2 lnvoters akparticontrol income1 income2 income3 income4 income5 income6 household1 household2 household3 household4 education1 education2 education3 education4 education5 education6 housetype1 housetype2 housetype3 housetype4 housetype5 housetype6 age1 age2 age3 kurdishsumbyID2 civiliansumbyID2 deathsumbyID2 if eligible==1 & greencard2~=. & kurdish~=. & akp07partisan~=. & religiosity~=. & incomeordinal~=. & householdordinal~=. & educationordinal~=. & housetypeordinal~=. & employed~=. & ageordinal~=. & female~=. & rural~=. & lnvoters~=. & akparticontrol~=. & eligible==1

*models with the whole sample
xtset mkkodu
xtlogit greencard2 kurdish akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural if eligible==1, fe or
outreg2 using greencardturkish, bdec(3) excel replace label eform cti(odds ratio)
logit greencard2 kurdish akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol if eligible==1, cluster(ilceid) or 
outreg2 using greencardturkish, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 c.absakpbdpcomp09 i.kurdish c.absakpbdpcomp09#i.kurdish akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol totalterrorbyID2  if eligible==1, cluster(ilceid) or
outreg2 using greencardturkish, bdec(3) excel append label eform cti(odds ratio)

logit greencard2 c.absakpbdpcomp09 i.kurdish c.absakpbdpcomp09#i.kurdish akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol totalterrorbyID2  if eligible==1, cluster(ilceid)
margins, at(absakpbdpcomp09=(0.1(0.1)0.7) kurdish=1 (median) akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural akparticontrol (mean) lnvoters totalterrorbyID2)
marginsplot
margins, at(absakpbdpcomp09=(0.1(0.1)0.7) kurdish=0 (median) akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural akparticontrol (mean) lnvoters totalterrorbyID2)
marginsplot

*categorical variables
xtlogit greencard2 kurdish akp07partisan religiosity income2 income3 income4 income5 income6 household2 household3 household4 education2 education3 education4 education5 education6 housetype2 housetype3 housetype4 housetype5 housetype6  employed age2 age3 female rural if eligible==1, fe or
outreg2 using greencardturkishapx2, bdec(3) excel replace label eform cti(odds ratio)
logit greencard2 kurdish akp07partisan religiosity income2 income3 income4 income5 income6 household2 household3 household4 education2 education3 education4 education5 education6 housetype2 housetype3 housetype4 housetype5 housetype6  employed age2 age3 female rural lnvoters akparticontrol if eligible==1, cluster(ilceid) or 
outreg2 using greencardturkishapx2, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity income2 income3 income4 income5 income6 household2 household3 household4 education2 education3 education4 education5 education6 housetype2 housetype3 housetype4 housetype5 housetype6  employed age2 age3 female rural lnvoters akparticontrol absakpbdpcomp09 totalterrorbyID2  if eligible==1 & kurdish==1, cluster(ilceid) or
outreg2 using greencardturkishapx2, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity income2 income3 income4 income5 income6 household2 household3 household4 education2 education3 education4 education5 education6 housetype2 housetype3 housetype4 housetype5 housetype6  employed age2 age3 female rural lnvoters akparticontrol absakpbdpcomp09 totalterrorbyID2  if eligible==1 & kurdish==0, cluster(ilceid) or
outreg2 using greencardturkishapx2, bdec(3) excel append label eform cti(odds ratio)


*alternative models
logit greencard2 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol absakpbdpcomp09 if eligible==1 & kurdish==1, cluster(ilceid) or
outreg2 using greencardturkishapx3, bdec(3) excel replace label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol absakpbdpcomp09 if eligible==1 & kurdish==0, cluster(ilceid) or
outreg2 using greencardturkishapx3, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol absakpbdpcomp09 kurdishsumbyID2 if eligible==1 & kurdish==1, cluster(ilceid) or
outreg2 using greencardturkishapx3, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol absakpbdpcomp09 kurdishsumbyID2 if eligible==1 & kurdish==0, cluster(ilceid) or
outreg2 using greencardturkishapx3, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol absakpbdpcomp09 civiliansumbyID2 if eligible==1 & kurdish==1, cluster(ilceid) or
outreg2 using greencardturkishapx3, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol absakpbdpcomp09 civiliansumbyID2 if eligible==1 & kurdish==0, cluster(ilceid) or
outreg2 using greencardturkishapx3, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol absakpbdpcomp09 deathsumbyID2 if eligible==1 & kurdish==1, cluster(ilceid) or
outreg2 using greencardturkishapx3, bdec(3) excel append label eform cti(odds ratio)
logit greencard2 akp07partisan religiosity incomeordinal householdordinal educationordinal housetypeordinal employed ageordinal female rural lnvoters akparticontrol absakpbdpcomp09 deathsumbyID2 if eligible==1 & kurdish==0, cluster(ilceid) or
outreg2 using greencardturkishapx3, bdec(3) excel append label eform cti(odds ratio)

